package cn.dansj.common.request.configure;

import cn.dansj.common.request.annotation.permission.Permission;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;

public interface PermissionFilter {

    default List<String> excludePathPatterns() {
        return Collections.emptyList();
    }

    boolean checkAuth(HttpServletRequest request, Method method, Permission permission, boolean pageNotFound);

    /**
     * 默认不拦截websocket请求
     */
    default boolean ignoreWebsocketRequest() {
        return true;
    }

    default void afterCompletion(ServletRequest servletRequest, ServletResponse servletResponse) {
    }
}
